(:
  A procedure to convert the contents of an ANVIL file
:)
declare boundary-space strip;
import module namespace
    jj = "http://kumquat.emse.fr/utilitaires"
    at "jjutils.xq" ;
<display>{
let $t := $arguments[1], $start := xs:decimal($arguments[2]), $loc := $arguments[3]
let $d := doc($t)//track[@name=$loc]/el
for $e at $p in $d
where $e/attribute[@name="speach"]
return
  <item show='yes' type='transcription'>{
    <info name="type">transcription</info> ,
    <info name="time">
      <time>
        <date>{$start+1000*xs:decimal(string($e/@start))}</date>
        <date>{$start+1000*xs:decimal(string($e/@end))}</date>
      </time>
    </info>,
    <info name="src-anchor">
      <anchor>{
        <doc>{ $t }</doc>,
        <path>{jj:build-Path($e)}</path>
      }</anchor>
    </info>,
    <info name="user">{$loc}</info>,
    <info name="content">
      <text color="red">{$loc,": ",$e//attribute/text()}</text> 
    </info>
  }</item>
}</display>
